﻿package system.logging.targets
{
	import com.crl.module.logging.LoggerLevel;
    
    
    /**
      * Provides a logger target that uses the global trace() method to output log messages.
      * <p><b>Example :</b></p>
      * package examples
      * {
      *     import system.logging.Log;
      *     import system.logging.Logger;
      *     import system.logging.LoggerLevel;
      *     import system.logging.targets.TraceTarget;
      *     
      *     import flash.display.Sprite;
      *     
      *     public class TraceTargetExample extends Sprite
      *     {
      *         public function TraceTargetExample()
      *         {
      *             // setup writer
      *             var target:TraceTarget = new TraceTarget() ;
      *             
      *             target.filters        = [ "examples.*" ] ;
      *             target.level          = LoggerLevel.ALL ;
      *             
      *             target.includeDate    = true ;
      *             target.includeTime    = true ;
      *             target.includeLevel   = true ;
      *             target.includeChannel = true ;
      *             target.includeLines   = true ;
      *             
      *             var logger:Logger = Log.getLogger( "examples.TraceTarget" ) ;
      *             
      *             logger.log   ( "Here is some myDebug info : {0} and {1}", 2.25 , true ) ;
      *             logger.debug ( "Here is some debug message." ) ;
      *             logger.info  ( "Here is some info message." ) ;
      *             logger.warn  ( "Here is some warn message." ) ;
      *             logger.error ( "Here is some error message." ) ;
      *             logger.fatal ( "Here is some fatal error..." ) ;
      *             
      *             target.includeDate    = false ;
      *             target.includeTime    = false ;
      *             target.includeChannel = false ;
      *             
      *             logger.info( "test : [{0}, {1}, {2}]", 2, 4, 6 ) ;
      *         }
      *     }
      * }
      * </pre>
      */
    public class TraceTarget extends LineFormattedTarget
    {
        /**
         * Creates a new TraceTarget instance.
         */
        public function TraceTarget()
        {
            //
        }
        
        /**
         * Descendants of this class should override this method to direct the specified message to the desired output.
         * @param message String containing preprocessed log message which may include time, date, channel, etc. 
         * based on property settings, such as <code class="prettyprint">includeDate</code>, <code class="prettyprint">includeChannel</code>, etc.
         */
        public override function internalLog( message:* , level:LoggerLevel ):void
        {
            trace( message ) ;
        }
    }
}